import 'package:flutter_model_package/StudentSubscription.dart';
import 'package:flutter_model_package/parse_base.dart';
import 'package:parse_server_sdk/parse_server_sdk.dart';

class TuitionService extends MSParseBase {
  TuitionService() : super("TuitionService");

  TuitionService.cloe() : this();

  @override
  TuitionService clone(Map<String, dynamic> map) =>
      TuitionService.cloe()..fromJson(map);

  QueryBuilder<StudentSubscription> subscriptions() {
    return QueryBuilder.or(StudentSubscription(), [
      QueryBuilder(StudentSubscription())..whereEqualTo("service", this),
      QueryBuilder(StudentSubscription())
        ..whereMatchesQuery("service",
            QueryBuilder(TuitionService())..whereEqualTo("services", this))
    ]);
  }
  QueryBuilder<TuitionService> getTuitionService(){
    return QueryBuilder(this)..includeObject(['category']);
  }
  QueryBuilder<TuitionService> searchTuition(String title){
    return QueryBuilder(this)..whereStartsWith("title", title)
      ..includeObject(["branches", "category", "package"]);
  }
}
